<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org/">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <base href="http://localhost/back/">

    <script type="text/javascript" src="lib/jquery/1.9.1/jquery.min.js"></script>
    <script type="text/javascript" src="lib/layer/1.9.3/layer.js"></script>
    <script type="text/javascript" src="js/ajaxUtils.js" charset="utf-8"></script>
    <script>
        //主加载
        $(function () {
            // 1.绑定点击事件
            $("#subBut").click(function () {
                // 2.获取数据
                var pw = $("#password").val();
                var repw = $("#repassword").val();
                // 3.比对
                if (pw != repw) {
                    // alert("两次密码不一致");
                    layer.msg("两次密码不一致", {icon: 2, time: 1000});
                    return;
                }
                // 3.获取Token
                var token = "[[${#request.getParameter('token')}]]";
                // 4.封装
                var param = {};
                param.password = pw;
                param.token = token;
                console.log(param);
                // 5.发送请求
                post("http://localhost/auth/changePassword", param, function (resp) {
                        layer.msg("密码修改成功", {icon: 1, time: 1000}, function () {
                            location.href = "http://localhost/auth/loginUser.html";
                        });
                });
            });
        })
    </script>
</head>
<body>

<h3>修改密码的页面</h3>
密码:<input type="password" id="password" name="password"><br>
确认密码:<input type="password" id="repassword" name="repassword"><br>
<input id="subBut" type="submit" value="提交">

</body>
</html>